import axios from "axios";

/**
 * 添加或更新权限
 * @param data
 */
export function saveOrUpdatePermission(data: any) {
    return axios.post("/sys/permission/saveOrUpdate", data);
}

/**
 * 分页查询权限
 */
export function getPagePermission(params: any) {
    return axios.get("/sys/permission/list/page", {
        params: params
    });
}

export function getAllPermission() {
    return axios.get("/sys/permission/list/all", {});
}


/**
 * 根据权限code删除权限
 * @param params
 */
export function deletePermissionByCode(params: any) {
    return axios.delete("/sys/permission/delete/code", {
        params: params
    });
}

export function exportPermissionFile(data: any) {
    return axios.post("/sys/permission/export", data, {
        responseType: 'blob'
    });
}

export function importPermissionFile(data: any) {
    return axios.post("/sys/permission/import", data, {
        headers: {'content-type': 'application/x-www-form-urlencoded'},
    });
}
